from .base import KeyframeStrategy
from typing import List, Set
from ..models import FrameData

class TopFramesStrategy(KeyframeStrategy):
    def __init__(self, num_top: int):
        self.num_top = num_top

    def detect(self, frames: List[FrameData]) -> Set[int]:
        sorted_frames = sorted(frames, key=lambda x: x.diff, reverse=True)
        return {f.id for f in sorted_frames[:self.num_top]}